﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.FriendRewardsUI {
    import flash.events.*;
    import flash.utils.*;
    import Display.DialogUI.*;
    import org.aswing.*;
    import Classes.util.*;
    import org.aswing.ext.*;
    import Display.aswingui.*;
    import com.adobe.serialization.json.*;

    public class FriendRewardsDialogView extends GenericDialogView {

        public static const LIST_WIDTH:int = 400;
        public static const LIST_HEIGHT:int = 300;

        protected var m_data:Array;
        protected var m_localeKey:String;

        public function FriendRewardsDialogView(_arg1:Array, _arg2:Dictionary, _arg3:String=null, _arg4:String="", _arg5:String="", _arg6:int=0, _arg7:Function=null, _arg8:String="", _arg9:int=0, _arg10:String="", _arg11:Function=null, _arg12:String=""){
            this.m_data = _arg1;
            this.m_localeKey = _arg3;
            super(_arg2, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12);
        }
        override protected function createButtonPanel():JPanel{
            var _local3:CustomButton;
            var _local1:JPanel = new JPanel(new FlowLayout(AsWingConstants.CENTER));
            m_acceptTextName.toUpperCase();
            var _local2:CustomButton = new CustomButton(m_acceptTextName, null, "GreenButtonUI");
            _local2.addActionListener(onAccept, 0, true);
            _local1.append(_local2);
            if (((!((this.m_data[0] == null))) && (!((this.m_data[0].uid == "-1"))))){
                _local3 = new CustomButton(ZLoc.t("Items", "zoodonation_thankYou"), null, "GreenButtonUI");
                _local3.addActionListener(onAccept, 0, true);
                _local3.addEventListener(MouseEvent.CLICK, this.onNeighborBarGiftClick, false, 0, true);
                _local1.append(_local3);
            };
            return (_local1);
        }
        public function onNeighborBarGiftClick(_arg1:MouseEvent):void{
            var _local3:Object;
            var _local2:Array = new Array();
            for each (_local3 in this.m_data) {
                _local2.push(_local3.uid);
            };
            FrameManager.navigateTo(("Gifts.php?action=chooseRecipient&gift=mysterygift_v1&view=custom_friends&friends=" + JSON.encode(_local2)));
        }
        override protected function createTextArea():JPanel{
            var _local1:JPanel = ASwingHelper.makeFlowJPanel(FlowLayout.LEFT, 0, 0);
            var _local2:VectorListModel = new VectorListModel(this.m_data);
            var _local3:Dictionary = m_assetDict;
            var _local4:VectorListModel = _local2;
            var _local5:GridListCellFactory = new FriendRewardsCellFactory(FriendRewardsCell, m_assetDict, this.m_localeKey);
            var _local6 = 1;
            var _local7 = 3;
            var _local8:int = LIST_WIDTH;
            var _local9:int = LIST_HEIGHT;
            var _local10:Boolean;
            var _local11:VerticalScrollingList = new VerticalScrollingList(_local3, _local4, _local5, _local6, _local7, _local8, _local9, _local10);
            ASwingHelper.setEasyBorder(_local1, 10, 20, 0, 20);
            _local1.append(_local11);
            return (_local1);
        }
        override protected function getTitleTokens():Object{
            return ({count:this.m_data.length});
        }

    }
}//package Display.FriendRewardsUI 
